<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>v-bind指令</title>
</head>
<body>
<div id="app">
    <!--<div class="active"></div>-->
    <div :class="classes"></div>

</div>
<script src="../vue.min.js"></script>
<script>
    // v-bind动态更新元素上的属性

    var app = new Vue({
        el: "#app",
        data: {
            isActive: true,
            error: null
        },
        computed: {
            classes: function () {
                /* mark 当后面的表达式为真的时候，就会有前面的属性值 */
                return {

                    active: this.isActive && !this.error,
                    'text-fail': this.error && this.error.type === 'fail',
                    active1:true,
                    active2:false,
                    //带连接线的必须加单引号
                    'active-3':true,
                    'text-fail1':true,
                    'text-fail2':false
                }
            }
        }
    })
</script>
</body>
</html>